<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>Document</title>

<link href="__PUBLIC__/css/layui.css" rel="stylesheet" type="text/css" media="all"/>
<script type="text/javascript" src="__PUBLIC__/layui.js"></script>

</head>
<style type="text/css">
    .da {width: 500px;height: 200px;background: #eee;margin: auto;}
    .da h3 {font-size: 18px;text-align: center;}
    .da ul {margin-left: 30px;}
    .da li {width: 100px;height: 140px;background: green;float: left;margin: 5px;list-style-type: none;}
    .da .one {background: url(__PUBLIC__/cj/chouj100.png);}
    .da .a_bnt {display:inline-block;width: 50px;height: 50px;background: #FFBE00;border-radius: 50px;
                text-align: center;line-height: 50px;text-decoration:none;margin-top: 68px;margin-left: 25px;}
</style>
<body>
        <div class="da">
            <h3>拆红包咯</h3>
            <ul>
                <?php if ($dr_time > $hongbao['hb_time']) { ?>
                    <li class="one"><a class="a_bnt" onclick="cj_num(this,'{$num}')" href="javascript:;" title="确定">拆</a></li>
                <?php }else { ?>
                    <li class="one"><a class="a_bnt" href="javascript:;"><?php echo floatval($hongbao['price']) ?>元</a></li>
                <?php } ?>

                <?php if ($dr_time > $hongbao['hb_time']) { ?>
                    <li class="one"><a class="a_bnt" onclick="cj_num(this,'{$num}')" href="javascript:;" title="确定">拆</a></li>
                <?php }else { ?>
                    <li class="one"><a class="a_bnt" href="javascript:;"><?php echo floatval($hongbao['price']) ?>元</a></li>
                <?php } ?>

                <?php if ($dr_time > $hongbao['hb_time']) { ?>
                    <li class="one"><a class="a_bnt" onclick="cj_num(this,'{$num}')" href="javascript:;" title="确定">拆</a></li>
                <?php }else { ?>
                    <li class="one"><a class="a_bnt" href="javascript:;"><?php echo floatval($hongbao['price']) ?>元</a></li>
                <?php } ?>

                <?php if ($dr_time > $hongbao['hb_time']) { ?>
                    <li class="one"><a class="a_bnt" onclick="cj_num(this,'{$num}')" href="javascript:;" title="确定">拆</a></li>
                <?php }else { ?>
                    <li class="one"><a class="a_bnt" href="javascript:;"><?php echo floatval($hongbao['price']) ?>元</a></li>
                <?php } ?>
            </ul>
        </div>
        <?php if ($dr_time > $hongbao['hb_time']) { ?>
            
        <?php }else { ?>
            <span style="margin-left: 30%;"><?php echo '时间在'.date('Y-m-d H:i:s',$hongbao['hb_time']).' 拆得红包：'.$hongbao['price'] ?>元</span>
        <?php } ?>

        <script>
            layui.use(['element','layer','form'], function(){
                $ = layui.jquery;//jquery
              lement = layui.element();//面包导航
              layer = layui.layer;//弹出层
              form = layui.form();//弹出层

          })
            
            /*拆红包*/
            function cj_num(obj,cj_num){
                //layer.confirm('确认要这个红包吗？',function(index){
                    //发异步删除数据
                    //data.field.cj_num = cj_num;
                    cj_num = cj_num;
                    $.ajax({
                        url: "{:U('home/chouj/cj_num_add')}",//请求地址
                        type: "post",//请求方式
                        dataType: "json",//返回数据类型
                        data: {cj_num:cj_num},//发送的参数
                        })
                        .done(function(response) {
                              if(response.error==1){
                                //layer.msg(response.info ,{icon:6});
                                location.reload();
                              }else{
                                layer.msg(response.info ,{icon:5});
                              }
                          })
                        .fail(function() {
                            alert("ajxs交互失败");
                        })  
                    return false;
                //});
            }
            </script>
</body>
</html>